package bizlogic;

import java.util.ArrayList;

import model.AppliedDataDTO;
import model.CalculateDTO;
import model.DetailDTO;
import dao.AppliedDataDAO;
import dao.CalculateDAO;
import dao.DAOFactory;
import dao.DetailDAO;
import exception.DAOSystemException;

public class UserManager1
{
	private AppliedDataDAO appliedDataDAO;
	private CalculateDAO calculateDAO;
	private DetailDAO detailDAO;
	
	public UserManager1() {
		
		appliedDataDAO=DAOFactory.loadInstance().getAppliedDataDAO();
		calculateDAO=DAOFactory.loadInstance().getCalculateDAO();
		detailDAO=DAOFactory.loadInstance().getDetailDAO();
	}
	
	@SuppressWarnings("finally")
	public DetailDTO findAppliedUser(String id)
	{
		DetailDTO currentUser = new DetailDTO();
		try 
		{
			currentUser = detailDAO.findAppliedUser(id);
		} catch (DAOSystemException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally
		{
			return currentUser;
		}
		
	}
	
	 public CalculateDTO getData(String id,String type)
	 {
		 
		 CalculateDTO calculate=new CalculateDTO();
			try 
			{
				calculate=calculateDAO.getData(id, type);
			} catch (DAOSystemException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
				return calculate;
			
	    }
	 
	 @SuppressWarnings("finally")
		public ArrayList<AppliedDataDTO> findAllAppliedUser(String id) {
	    	ArrayList<AppliedDataDTO> currentList = new ArrayList<AppliedDataDTO>();
			try {
				currentList = appliedDataDAO.findAllAppliedUser(id);
			} catch (DAOSystemException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} finally
			{
				return currentList;
			}
	    }
	    
	    @SuppressWarnings("finally")
		public ArrayList<AppliedDataDTO> findAppliedCompensation(String id) {
	    	ArrayList<AppliedDataDTO> currentList = new ArrayList<AppliedDataDTO>();
			try {
				currentList = appliedDataDAO.findAppliedCompensation(id);
			} catch (DAOSystemException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} finally
			{
				return currentList;
			}
	    }

}
